﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Circle.Domain.Entity;
using Circle.Web.ViewModelsClient;
using Circle.Manager;

namespace Circle.Web.ViewModels
{
    public abstract class  ViewModel
    {
       
    }

    public abstract class IdenticalViewModel : ViewModel
    {
        public abstract Guid Id { get; }

        public virtual bool IsNew()
        {
            return Id == Guid.Empty;
        }
    }

    public abstract class OwnerViewModel : IdenticalViewModel
    {
        public abstract Guid UserId { get; }
        public abstract string UserName { get; }

    }

    //public abstract class IdenticalViewModel<E> : IdenticalViewModel where E : BaseEntity
    //{
    //    protected E Entity;

    //    public IdenticalViewModel() { }

    //    public IdenticalViewModel(E entity)
    //    {
    //        Entity = entity;
    //    }

    //    public E Model
    //    {
    //        get { return Entity; }
    //        set { Entity = value; }
    //    }
    //}

   

    //public interface IContainEntity
    //{ 
    //    BaseEntity ContainedEntity {get;}
    //}


    //public abstract class OwnerViewModel<E> : OwnerViewModel, IContainEntity where E : BaseOwnerEntity 
    //{
    //    protected E Entity;

    //    private Guid _userId;

    //    private string _userName;

    //    public OwnerViewModel() 
    //    {
    //        var currentUser = SecurityManager.CurrentUser;
    //        if (currentUser != null)
    //        {
    //            _userId = currentUser.UserId;
    //            _userName = currentUser.UserName;
    //        }
    //    }

    //    public OwnerViewModel(E entity)
    //    {
    //        Entity = entity;
    //        _userId = entity.UserId;
    //        _userName = entity.User.UserName;
    //    }

    //    public BaseEntity ContainedEntity
    //    {
    //        get { return Entity; }
    //    }

    //    public E Model 
    //    {
    //        get { return Entity; }
    //        set { Entity = value; }
    //    }

    //    public override Guid Id
    //    {
    //        get { return Entity.Id; }
    //    }

    //    public override Guid UserId
    //    {
    //        get { return _userId; }
    //        //set { _userId = value; }
    //    }

    //    public override string UserName
    //    {
    //        get { return _userName; }
    //        //set { _userName = value; }
    //    }
    //}

}